#include "CrossPassToGoalBehaviour.h"


/*
 * Krizova prihravka pred branku 
 */
void CrossPassToGoalBehaviour::Behave()
{
	Point passPosition;
	Point myPosition = world->me->pos;

	if(myPosition.GetY() < 0)
	{
		passPosition.SetX(38.0); passPosition.SetY(8.0);
	}
	else if (myPosition.GetY() > 0)
	{
		passPosition.SetX(38.0); passPosition.SetY(-8.0);
	}
				
	Vector vectFromMeToPassPoint = passPosition - myPosition;
	float lfDistance = vectFromMeToPassPoint.GetLength();
	float lfPassSpeed = world->params->server->ball_speed_max;
				
	GetPassBallToBehaviour()->Behave(passPosition, GetPassBallToBehaviour()->CorrectPassSpeed(lfPassSpeed));
}
